<template>
	<view style="background-color: white;">
		<view v-if="jifenRecord.length>0">
			<view class="order-box" v-for="(item,i) in jifenRecord" :key="item.index">
				<view class="box-b" style="display:flex;">
					<view class = "info">
						<view class="number">输出:{{item.from}}</view>
						<view class="time">输入:{{item.to}}</view>
					</view>
					<view class = "ways">
						<view style="margin-bottom:7px;">积分:{{item.jifen}}</view>
						<view>时间:{{item.time}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="tips-text">{{tips}}</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,			//页数
				size:10,		//条数
				jifenRecord:[], //积分记录集合
				tips:"上拉加载更多数据",
			}
		},
		onReachBottom() {
			if(this.tips=='上拉加载更多数据'){
				this.page++;
				this.getJifenRecord();
			}
		},
		onLoad() {
			this.getJifenRecord()
		},
		methods: {
			getJifenRecord(){
				this.$http.get('/jifen.do', {
					p:'jifenjiluxcx',
					page:this.page,
					size:this.size,
					userid:uni.getStorageSync('usersId')
				}).then(res => {
					if(res.data.code==200){
						if(res.data.data.length > 0){
							this.jifenRecord=this.jifenRecord.concat(res.data.data);
							if(this.page==1 && res.data.data.length<this.size){
								this.tips="";
							}
						}else{
							this.tips="没有更多数据";
						}
					}else{
						this.tips="没有更多数据";
					}
				})
			},
		}
	}
</script>

<style>
	.time,.ways,.detail{
		font-size: 14px;
		color: #909399;
	}
	.order-box{
		padding: 30rpx 0 30rpx 30rpx;
		border-bottom: 1px #d1d1d1 solid;
	}
	.info {
		float: left;
	}
	.number {
		font-size: 14px;
		color: #909399;
		margin-bottom: 5px;
	}
	.time {
		font-size: 14px;
	}
	.ways {
		float: left;
		margin-left: 20px;
	}
	.nav-header h1 {
		text-align: left;
	}
	.nav-header a {
		color: white;
	}
	.tips-text,.no-goods-box{
		text-align: center;
	}
</style>
